package com.mproject.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.mproject.activity.R;
import com.mproject.activity.project.Project_Schedule_Month;
import com.mproject.customclass.Event;


public class Project_Schedule_Event_List_Adapter extends ArrayAdapter<Event>{

	private static final String tag = "AttendeeListAdapter";

	// private static final String ASSETS_DIR = "images/";
	private Context context;
	Project_Schedule_Month activity;

	private TextView time;
	private TextView detail;

	private List<Event> eventList = new ArrayList<Event>();
	public Project_Schedule_Event_List_Adapter(Project_Schedule_Month activity,Context context, int textViewResourceId,List<Event> eventList)
	{
		super(context, textViewResourceId, eventList);
		this.context = context;
		this.eventList = eventList;
		this.activity=activity;
		Log.v(tag,"in constructor");
	}
	public int getCount() 
	{
		return this.eventList.size();
	}
	public Event getItem(int index) 
	{
		return this.eventList.get(index);
	}
	public View getView(final int position, View convertView, ViewGroup parent) 
	{
		View row = convertView;
		if (row == null) 
		{
			Log.d(tag, "Starting XML Row Inflation ... ");
			LayoutInflater inflater = (LayoutInflater) this.getContext()
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			row = inflater.inflate(R.layout.project_schedule_event_list_item, parent, false);
			Log.d(tag, "Successfully completed XML Row Inflation!");
		}

		final Event event = getItem(position);

		
		detail = (TextView) row.findViewById(R.id.project_schedule_event_detail);
		time = (TextView) row.findViewById(R.id.project_schedule_event_starttime);
	


		detail.setText(event.getDetail());
		time.setText(event.getTime());	

		
		return row;
	}

}

